﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Home.Master" AutoEventWireup="true"
    CodeBehind="ListVillages.aspx.cs" Inherits="Giaiphongmatbang.ListVillages" %>

<%@ Register Src="~/UserControl/ucPaging.ascx" TagName="ucPaging" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="Style/duan.css" rel="stylesheet" type="text/css" />
    <link href="Style/skinstyle.css" rel="stylesheet" type="text/css" />
    <link href="Style/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
    <script src="Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function showdialog() {
            $('.dialogForm').dialog({
                modal: true,
                autoOpen: false,
                width: 400,
                close: function () {
                    allFields.val("").removeClass("ui-state-error");
                }
            });
            $(".dialogForm").parent().appendTo($("form:first"))
            $('.dialogForm').dialog('open');
            return false;
        }

        $(document).ready(function () {
            $('.dialogForm').dialog({
                modal: true,
                autoOpen: false,
                width: 400,
                close: function () {
                    allFields.val("").removeClass("ui-state-error");
                }
            });
            $("#btnCancel").click(function () {
                $('.dialogForm').dialog('close');
            });
        });

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="table">
        <asp:Panel ID="pnl1" runat="server">
            <div class="box-title-a">
                Danh sách các xã trên địa bàn huyện
            </div>
            <div class="box-title-a" style="text-align: right; padding-right: 2px;">
                <asp:Button ID="btnAdd" runat="server" Text="Thêm mới xã" CssClass="button" OnClick="btnAdd_Click"
                    ToolTip="Thêm mới một xã vào huyên Hưng Nguyên" ValidationGroup="1" />
            </div>
            <asp:GridView ID="grvVillage" runat="server" AutoGenerateColumns="false" Width="100%"
                BorderWidth="0" GridLines="None" OnRowCommand="grvVillage_RowCommand" OnRowDataBound="grvVillage_RowDataBound">
                <Columns>
                    <asp:TemplateField HeaderText="TT" ItemStyle-Width="10px">
                        <ItemTemplate>
                            <%#(Container.DataItemIndex + 1) + (ucPaging1.CurrentPage - 1)*ucPaging1.PageSize %>
                        </ItemTemplate>
                        <ItemStyle Width="10px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Tên xã, thị trấn">
                        <ItemTemplate>
                            <asp:LinkButton ID="lbtVillage" OnClick="lbtVillage_Click" runat="server" CommandArgument='<%#Eval("VillageID") %>'
                                ToolTip="Xem dự án trên địa bàn xã" ValidationGroup="1"><%#Eval("VillageName") %></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Chức năng" ItemStyle-Width="90px">
                        <ItemTemplate>
                            <asp:ImageButton ID="btnEdit" runat="server" ImageUrl="~/Images/pen.png" CommandArgument='<%#Eval("VillageID") %>'
                                CommandName="btnEdit" ValidationGroup="1" />
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:ImageButton ID="btnDelete" runat="server" ImageUrl="~/Images/delete.png" CommandArgument='<%#Eval("VillageID") %>'
                                CommandName="btnDelete" OnClientClick="return confirm('Bạn muốn xóa xã này?')"
                                ValidationGroup="1" />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle HorizontalAlign="Center" />
            </asp:GridView>
            <%--End gridview villages--%>
            <uc1:ucPaging ID="ucPaging1" runat="server" />
        </asp:Panel>
        <%--End Panel Project--%>
        <%--End div--%>
        <asp:Panel ID="pnl2" runat="server" Visible="false">
            <div class="box-content">
                <p>
                    <span>Tên xã:</span>
                    <asp:Literal ID="ltrVillageName" runat="server" /></p>
                <p>
                    <span>Tổng số dự án trên địa bàn:</span>
                    <asp:Literal ID="ltrTotalProjectInVillage" runat="server" /></p>
            </div>
            <div class="box-title-a">
                Danh sách các dự án trên địa bàn xã:
            </div>
            <div class="table">
                <asp:GridView ID="grvProject" runat="server" AutoGenerateColumns="false" Width="100%"
                    BorderWidth="0" GridLines="None">
                    <Columns>
                        <asp:TemplateField HeaderText="TT" ItemStyle-Width="10px">
                            <ItemTemplate>
                                <%#(Container.DataItemIndex + 1) + (ucPaging2.CurrentPage - 1)*ucPaging2.PageSize %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Dự án">
                            <ItemTemplate>
                                <asp:LinkButton ID="lbtProject" OnClick="lbtProject_Click" runat="server" CommandArgument='<%#Eval("ProjectID") %>'
                                    ToolTip="Xem các hộ dân nằm trong dự án" ValidationGroup="1"><%#Eval("ProjectName") %></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="Investor" HeaderText="Chủ đầu tư" />
                    </Columns>
                </asp:GridView>
                <uc1:ucPaging ID="ucPaging2" runat="server" />
            </div>
            <div style="width: 100%; height: 15px; border: none;">
            </div>
            <div style="display: none">
                <asp:HiddenField ID="hdfmodenew" runat="server" />
            </div>
            <div class="box-title-a">
                Danh sách các hộ chịu ảnh hưởng <span style="float: right; padding-right: 2px;">
                    <asp:Button ID="btnAll" runat="server" Text="Xem tất cả" OnClick="btnAll_Click" CssClass="button" ValidationGroup="1" />
                </span>
            </div>
            <div class="table">
                <asp:GridView ID="grvHouseHold" runat="server" AutoGenerateColumns="false" Width="100%"
                    BorderWidth="0" GridLines="None">
                    <Columns>
                        <asp:TemplateField HeaderText="TT" ItemStyle-Width="10px">
                            <ItemTemplate>
                                <%#(Container.DataItemIndex + 1) + (ucPaging3.CurrentPage - 1)*ucPaging3.PageSize %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="CMND" HeaderText="CMND" />
                        <asp:BoundField DataField="FullName" HeaderText="Tên chủ hộ" />
                        <asp:BoundField DataField="Address" HeaderText="Địa chỉ" />
                        <asp:BoundField DataField="PhoneNumber" HeaderText="Điện thoại" />
                        <asp:TemplateField HeaderText="Giới tính">
                            <ItemTemplate>
                                <%#Eval("Gender").ToString()=="True"?"Nam":"Nữ" %>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                <uc1:ucPaging ID="ucPaging3" runat="server" />
            </div>
            <div class="box-content" style="text-align: center">
                <asp:Button ID="btnReturn2" CssClass="button" runat="server" Text="Trở về" OnClick="btnReturn2_Click"
                    ValidationGroup="1" />
            </div>
            <!--End table-->
        </asp:Panel>
    </div>
    <div class="dialogForm" title="Quản lý danh mục xã" style="display: none">
        <table cellpadding="5" cellspacing="5">
            <tr>
                <td style="width: 80px;">
                    Tên xã
                </td>
                <td style="width: 240px">
                    <asp:TextBox ID="txtVillageName" runat="server" Style="width: 100%" AutoComplete="Off"
                        CssClass="field"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Tên xã bắt buộc phải nhập"
                        ControlToValidate="txtVillageName"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    Huyện
                </td>
                <td>
                    <asp:DropDownList ID="ddlParent" runat="server" Width="100%" CssClass="field" />
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    <asp:Button ID="btnAddVillage" CssClass="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
                        runat="server" Text="&nbsp;OK&nbsp;" OnClick="btnAddVillage_Click" />
                    <input type="button" id="btnCancel" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" value="Cancel" />
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
